<?php

namespace Roles\Controller;

use Zend\Mvc\Controller\AbstractActionController,
    Zend\View\Model\ViewModel;

class RestrictedController extends AbstractActionController {

   private function checkLogin() {
      if (! $this->getServiceLocator()
                 ->get('AuthService')->hasIdentity()){
         return $this->redirect()->toRoute('login');
      }
   }

   public function indexAction() {

      $this->checkLogin();

      return new ViewModel();
   }

}
